<template>
  <div>
    <span>asdasdasd</span>
    <div class="gContainer" style="background: #6ecbf3">
      <div class="chart_tree" style="background: #409EFB">
        <!--        <chartTree :data="treeData" ref="tree"></chartTree>-->
        <chartTest :data="data" ref="tree"></chartTest>
<!--        <chartGraph :data="data" ref="tree"></chartGraph>-->
      </div>
    </div>
  </div>
</template>

<script>
import chartTest from '@/components/chartOCGraph'
import chartGraph from '@/components/chartGraph'

export default {
  name: 'app',
  components: {
    chartTest,
    // eslint-disable-next-line vue/no-unused-components
    chartGraph
  },
  data () {
    return {
      formInline: {
        username: '',
        email: ''
      },
      data: [],
      results: '',
      contextMenuTarget: document.body,
      contextMenuVisible: false
    }
  },
  methods: {
    onSubmitGet () {
      console.log('submit! get')
      this.$axios.get('api/users/').then(res => { // get()中的参数要与mock.js文件中的Mock.mock()配置的路由保持一致
        // axios.get('http://127.0.0.1:8000/users.json',).then(res => {//get()中的参数要与mock.js文件中的Mock.mock()配置的路由保持一致
        this.results = JSON.stringify(res.data)
        console.log(res.data) // 在console中看到数据
      }).catch(res => {
        alert('wrong')
      })
    },
    onSubmitPost () {
      console.log('submit! post')
      this.$axios.post('api/users/', this.formInline).then(res => { // get()中的参数要与mock.js文件中的Mock.mock()配置的路由保持一致
        // axios.post('http://127.0.0.1:8000/users.json',this.formInline).then(res => {//get()中的参数要与mock.js文件中的Mock.mock()配置的路由保持一致
        console.log(res.data) // 在console中看到数据
      }).catch(res => {
        alert('wrong')
      })
    },
    copyMsg () {
      alert('copy')
      this.contextMenuVisible = false
    },
    quoteMsg () {
      alert('quote')
      this.contextMenuVisible = false
    },
    deleteMsg () {
      alert('delete')
      this.contextMenuVisible = false
    }
  }
}
</script>

<style>
body {
  height: 100%;
  font-size: 14px;
}

#app {
  font-family: 'Microsoft Yahei', 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
  height: 100%;
}

h1,
h2 {
  font-weight: normal;
}

a {
  color: #333;
}

.right-menu {
  position: fixed;
  background: #fff;
  border: solid 1px rgba(0, 0, 0, .2);
  border-radius: 3px;
  z-index: 999;
  display: none;
}

.right-menu a {
  width: 75px;
  height: 28px;
  line-height: 28px;
  text-align: center;
  display: block;
  color: #1a1a1a;
}

.right-menu a:hover {
  background: #eee;
  color: #fff;
}

html,
body {
  height: 100%;
}

.right-menu {
  border: 1px solid #eee;
  box-shadow: 0 0.5em 1em 0 rgba(0, 0, 0, .1);
  border-radius: 1px;
}

a {
  text-decoration: none;
}

.right-menu a {
  padding: 2px;
}

.right-menu a:hover {
  background: #42b983;
}

.chart_barVec {
  border: 1px solid #ededed;
  width: calc((100% - 30px) / 2);
  height: 450px;
  margin: 0 10px 10px 0;
  float: right;
}

.chart_barVec:nth-child(3n) {
  margin-right: 0;
}
.gContainer {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.chart_tree {
  border: 1px solid #ededed;
  width: calc((100% - 30px) * 0.8);
  height: 1000px;
  margin: 0 10px 10px 0;
  float: left;
}

.chart_tree:nth-child(3n) {
  margin-right: 0;
}

</style>
